﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace WindowsFormsApplication1.DAO
{
    class DonViDAO
    {
        public static string GetTenDonVi(int maDonVi)
        {
            SqlConnection ketNoi = AbstractDAO.Connection();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = ketNoi;
            cmd.CommandText = @"SELECT TenDonVi FROM DONVI WHERE ID="+maDonVi;

            SqlDataReader boDoc = cmd.ExecuteReader();
            string re = null;
            while (boDoc.Read())
            {
                re = boDoc.GetString(0);
            }
            boDoc.Close();
            return re;
        }
    }
}
